<%= content_for(:page_title) do %>
  <%= Spree.t(:store_details) %>
<% end %>


<div class="card mb-4">
  <div class="card-header">
    <h5 class="card-title"><%= Spree.t(:name) %> & <%= Spree.t(:logo) %></h5>
  </div>
  <div class="card-body">
    <p class="text-muted">
      <%= Spree.t(:store_name_help) %>
    </p>
    <%= f.spree_text_field :name, required: true, autofocus: f.object.new_record? %>

    <%= f.spree_file_field :logo, width: 240, height: 240, crop: true, help_bubble: "Used in the admin dashboard" %>
  </div>
</div>

<div class="card mb-4">
  <div class="card-header">
    <h5 class="card-title"><%= Spree.t(:currencies) %> & <%= Spree.t(:translations) %></h5>
  </div>
  <div class="card-body">
    <%= f.spree_select :default_currency, currency_options(@store.default_currency), { label: Spree.t(:default_currency), autocomplete: true } %>
    <%= f.spree_select :supported_currencies, currency_options(@store.supported_currencies&.split(',')), { prompt: false, multiple: true, autocomplete: true } %>
    <hr />
    <%= f.spree_select :default_locale, options_from_collection_for_select(all_locales_options, :last, :first, @store.default_locale || I18n.locale), { autocomplete: true } %>
    <%= f.spree_select :supported_locales, options_from_collection_for_select(all_locales_options, :last, :first, @store.supported_locales&.split(',')), { multiple: true, autocomplete: true } %>
  </div>
</div>

<div class="card mb-4">
  <div class="card-header">
    <h5 class="card-title"><%= Spree.t(:standards_and_formats) %></h5>
  </div>
  <div class="card-body">
    <p class="text-muted">
      <%= Spree.t(:standards_and_formats_help) %>
    </p>
    <div class="form-group mb-3">
      <%= label_tag :preferred_timezone, raw(Spree.t(:timezone) + required_span_tag) %>
      <%= time_zone_select :store, :preferred_timezone, nil, {}, { data: { controller: 'autocomplete-select' } } %>
    </div>
    <div data-controller="unit-system">
      <%= f.spree_select :preferred_unit_system, options_for_select(unit_systems, @store.preferred_unit_system), { label: Spree.t(:unit_system), help_bubble: Spree.t(:unit_system_help) }, { data: { unit_system_target: "body", action: "change->unit-system#unitSystemHandler" } } %>
      <%= f.spree_select :preferred_weight_unit, options_for_select(weight_units(@store), @store.preferred_weight_unit), { label: Spree.t(:weight_unit), help_bubble: Spree.t(:weight_unit_help) }, { data: { unit_system_target: "weightUnit" } } %>
    </div>
  </div>
</div>

<div class="card mb-4">
  <div class="card-header">
    <h5 class="card-title"><%= Spree.t(:phone) %> & <%= Spree.t(:address) %></h5>
  </div>
  <div class="card-body">
    <%= f.spree_text_field :contact_phone %>
    <%= f.spree_text_area :address %>
  </div>
</div>

<div class="card mb-4">
  <div class="card-header">
    <h5 class="card-title"><%= Spree.t(:digital_assets) %></h5>
  </div>
  <div class="card-body">
    <p class="text-muted">
      <%= Spree.t(:digital_assets_help) %>
    </p>
    <%= f.spree_check_box :preferred_limit_digital_download_days %>
    <%= f.spree_number_field :preferred_digital_asset_authorized_days, min: 1 %>
    <%= f.spree_check_box :preferred_limit_digital_download_count %>
    <%= f.spree_number_field :preferred_digital_asset_authorized_clicks, min: 1 %>
  </div>
</div>

<%= render_admin_partials(:store_form_partials, f: f, store: @store) %>
